using UnityEditor;
using System.IO;

public class ScriptTemplate : AssetModificationProcessor
{
    public static void OnWillCreateAsset(string path)
    {
        if (!path.EndsWith(".cs.meta")) return;
        string originalFilePath = AssetDatabase.GetAssetPathFromTextMetaFilePath(path);
        string file = File.ReadAllText(originalFilePath);
        file = file.Replace("#CreateTime#", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
        // file = file.Replace("#PROJECTNAME#", PlayerSettings.productName);
        // file = file.Replace("#SMARTDEVELOPERS#", PlayerSettings.companyName);
        File.WriteAllText(originalFilePath, file);
        AssetDatabase.Refresh();
    }
}
